package org.zfes.snowier.xyz.analysis.analysers;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zfes.snowier.common.chains.handler.HandlerAdapter;
import org.zfes.snowier.common.chains.handler.HandlerEntry;
import org.zfes.snowier.common.chains.session.ISession;
import org.zfes.snowier.core.util.AppCtxUtil;

import org.zfes.snowier.zbss.xzy.cache.ISingleDataCache;
import org.zfes.snowier.zbss.xzy.mo.dtos.MoDataMsg;
import org.zfes.snowier.zbss.xzy.mo.dtos.MoDataType;

public class FillCacheHandler  extends HandlerAdapter{
	
	private static final Logger logger = LoggerFactory.getLogger(FillCacheHandler.class);
	
	private ISingleDataCache dataCache;
	
	@Override
	protected void doHandleExcute(ISession session, Object data, HandlerEntry entry) {
		
		
		logger.info("-FillCacheHandler-before-doHandleExcute---data:{}",data);
		
		MoDataMsg dataMsg= (MoDataMsg)data;
		
		MoDataType dataType=dataMsg.getType();
		
		
//		IBaseMDto mdto= (IBaseMDto)data;
		
//		logger.info("-FillCacheHandler-before-put-cache-st:{}",mdto.getDevice().getSt());
//		
//		getDataCache().putDMoData(mdto.getDevice().getDevicesn(), mdto);
//		
//		logger.info("-FaultHandler-after-put-cache---");
		
		
	}

	
	private ISingleDataCache getDataCache() {
		if(dataCache==null) {
			dataCache=(ISingleDataCache)AppCtxUtil.cfg.getBean("modataCache");
		}
		return dataCache;
	}
}
